package com.twu.biblioteca;

/**
 * Created with IntelliJ IDEA.
 * User: Thoughtworker
 * Date: 8/26/13
 * Time: 5:11 PM
 * To change this template use File | Settings | File Templates.
 */
public class Library {
    User user;
    UserGetter userGetter;

    public Library(UserGetter userGetter)
    {
        this.userGetter = userGetter;
        this.user = null;
    }


    public void validateUserPassword(String username, String password) {
        User user = userGetter.verifyUserExists(username);
        System.out.println("TEST!");
        if(userGetter.verifyUserAndPassword(user, password))
        {
            this.user = user;
            userGetter.setUser(user);
        }
    }

    public boolean hasValidatedUser()
    {
        return user != null;
    }
}
